﻿using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using QuanLyNganHangDe.DAL.Models.Mapping;
using QuanLyNganHangDe.GUI.HeThong;
using System;
using QuanLyNganHangDe.GUI;

namespace QuanLyNganHangDe.DAL.Models
{
    public partial class QLNHD_KHContext : DbContext
    {
        static QLNHD_KHContext()
        {
            Database.SetInitializer<QLNHD_KHContext>(null);
            //Database.SetInitializer(new DropCreateDatabaseIfModelChanges<QLNHD_KHContext>());
            //Database.SetInitializer(new MyInitializer());
        }

        public QLNHD_KHContext()
            : base(string.IsNullOrEmpty(Program.connectionString) ? "Name=QLNHD_KHEntities" : Program.connectionString)
        //   : base("Name=QLNHD_KHEntities")
        {
        }

        public DbSet<CauHoi> CauHoiDbSet { get; set; }
        public DbSet<DeInRa> DeInRaDbSet { get; set; }
        public DbSet<DonViPhuTrach> DonViPhuTrachDbSet { get; set; }
        public DbSet<DotThi> DotThiDbSet { get; set; }
        public DbSet<HocKy> HocKyDbSet { get; set; }
        public DbSet<HocPhan> HocPhanDbSet { get; set; }
        public DbSet<Khoi> KhoiDbSet { get; set; }
        public DbSet<NamHoc> NamHocDbSet { get; set; }
        public DbSet<NguoiSuDung> NguoiSuDungDbSet { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CauHoiMap());
            modelBuilder.Configurations.Add(new DeInRaMap());
            modelBuilder.Configurations.Add(new DonViPhuTrachMap());
            modelBuilder.Configurations.Add(new DotThiMap());
            modelBuilder.Configurations.Add(new HocKyMap());
            modelBuilder.Configurations.Add(new HocPhanMap());
            modelBuilder.Configurations.Add(new KhoiMap());
            modelBuilder.Configurations.Add(new NamHocMap());
            modelBuilder.Configurations.Add(new NguoiSuDungMap());
        }
    }
}
